﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLTV_Public;
using System.Data;

namespace QLTV_Data
{
   public class ViTri_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable layDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_ViTri");
       }
       public int insert_ViTri(ViTriLuuTru_Public tenViTri,ViTriLuuTru_Public moTa)
       {
           int Nparamerter = 2;
           string[] name = new string[Nparamerter];
           object[] value = new object[Nparamerter];
           name[0] = "@TenViTri";
           value[0] = tenViTri.TenViTri;
           name[1] = "@MoTa";
           value[1] = moTa.MoTa;
           return kn.update("Insert_ViTri",name,value,Nparamerter);   
       }
       public int update_ViTri(ViTriLuuTru_Public maViTri,ViTriLuuTru_Public tenViTri, ViTriLuuTru_Public moTa)
       {
           int Nparamerter = 3;
           string[] name = new string[Nparamerter];
           object[] value = new object[Nparamerter];
           name[0] = "@MaViTri";
           value[0] = maViTri.MaViTri;
           name[1] = "@TenViTri";
           value[1] = tenViTri.TenViTri;
           name[2] = "@MoTa";
           value[2] = moTa.MoTa;
           return kn.update("Update_ViTri", name, value, Nparamerter);  
       }
       public int delete_ViTri(ViTriLuuTru_Public maViTri)
       {
           int Nparamerter = 1;
           string[] name = new string[Nparamerter];
           object[] value = new object[Nparamerter];
           name[0] = "@MaViTri";
           value[0] = maViTri.MaViTri;
           return kn.update("Delete_ViTri", name, value, Nparamerter);
       }
    }
}
